package com.jin10.controller;

import cn.hutool.core.date.DateUtil;
import com.jin10.bean.BaseResponse;
import com.jin10.dto.NonFarmArrangeDto;
import com.jin10.service.IArticleArrangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import java.util.Objects;

/**
 * @author raofy
 * @date 2022-03-09 10:48
 * @desc
 */
@RestController
@RequestMapping("article")
public class ArticleArrangementReturnController {

    @Autowired
    IArticleArrangeService iArticleArrangeService;

    @PostMapping("getNonFarmArrange")
    public BaseResponse getNonFarmArrange(@RequestBody NonFarmArrangeDto dto) {
        return BaseResponse.ok(iArticleArrangeService.getNonFarmArrange(dto));
    }

    @PostMapping("getTitle")
    public BaseResponse getTitle(@RequestParam(required = false) Float actual,
                                 @RequestParam(required = false) Float consensus,
                                 @RequestParam(required = false) Float previous) {
        NonFarmArrangeDto dto = new NonFarmArrangeDto();
        dto.setActual(actual);
        dto.setConsensus(consensus);
        dto.setPrevious(previous);
        return BaseResponse.ok(iArticleArrangeService.getTitle(dto));
    }
}
